import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.concurrent.BlockingQueue;



public class Test {
    public static void insertSort(int[] arr){
        int i=1;
        for(;i< arr.length;i++){
            int temp=arr[i];
            int j=i-1;
            for (;j>=0;j--){
                if(arr[j]>temp){
                    arr[j+1]=arr[j];
                }else{
                    break;
                }
            }
            arr[j]=temp;
        }
    }


    public static void Shell(int[] arr,int gap){
        for (int i = gap; i < arr.length; i++) {
            int j=i-gap;
            int temp = arr[i];
            for(; j >= 0; j-=gap){

                if(arr[j] > temp){
                    arr[j+gap]=arr[j];
                }else {
                    break;
                }
            }
            arr[j+gap]=temp;
        }
    }
    public static void shellSort(int[] arr){
        int gap=arr.length/2;
        while(gap > 1){
            Shell(arr,gap);
            gap/=2;
        }
        Shell(arr,1);

    }


    public static void selectSort(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            int min=arr[i];
            int minIndex=i;
            for (int j = i+1; j < arr.length; j++) {
                if(arr[j] < min){
                    minIndex=j;
                }
            }
            int temp=arr[i];
            arr[i]=arr[minIndex];
            arr[minIndex]=temp;
        }
    }



    public static void main(String[] args) {
        int[] arr={700,716,728,719,685,709,691,684,705,718,706,715,712,722,691,708,};

        selectSort(arr);
        System.out.println(Arrays.toString(arr));
    }
}
